#pragma  once



class MenuBuilder{
public:
	MenuBuilder(HMENU menu = 0);
	MenuBuilder(const MenuBuilder& other);
public:
	void Create();
	void CreateAsSub();
	void CreateAsPopup();
	
	HMENU GetMenu();
	operator HMENU();
	MenuBuilder& operator =(HMENU m);
	int GetItemCount();
	void DeleteItem(wstring key);
	void DeleteItem(int  index);
	void CheckItem(int index, bool check = true);
	void CheckItem(wstring key, bool check = true);

	BOOL AppendSubMenu(wstring text, HMENU subMenu);
	BOOL InsertSubMenu(int index, wstring text, HMENU subMenu);
	HMENU GetSubMenu(wstring text);
	bool IsSubMenu(int index);
	HMENU GetSubMenu(int index);
	BOOL AppendSeprator();
	BOOL InsertSeprator(int index);
	BOOL InsertSeprator(wstring relKey);

	BOOL AppendItem(wstring key, wstring text);
	BOOL InsertItem(int index, wstring key, wstring text);
	BOOL InsertItem(wstring relKey, wstring key, wstring text);
	BOOL SetItemString(int index, wstring text);
	BOOL SetItemString(wstring key, wstring text);
	wstring GetItemString(int index);
	wstring GetItemString(wstring key);

private:
	HMENU menu_;
};
